import os
from multiprocessing import Process


class MyProcess(Process):
    def __init__(self, name):
        super().__init__()
        self.name = name

    def run(self):
        print("进程为%s，父进程为%s" % (os.getpid(), os.getppid()))
        print("我的名字是%s" % self.name)


if __name__ == '__main__':
    p_one = MyProcess('张三')
    p_two = MyProcess('李四')

    p_one.start()  # 自动调用run()
    p_two.start()

    p_one.join()
    p_two.join()

    print("主进程结束")